<template>
  <div class="hos-nav">
    <div id="map" style="width:100%;height:50vh;border-radius:20px;"></div>
    <div class="healthyCheck" @click="checkHeathy">健康打卡</div>
    <div class="panel">
      <div style="padding:10px;">
        <div class="daka_staff">
          <div class="daka_staffinfo" style="color:#6A6A6A">{{staffInfo.hospName}}</div>
          <div class="daka_staffinfo" style="color:#333;font-weight:bold;">{{staffInfo.staffName}}({{staffInfo.id}})</div>
          <div class="daka_staffinfo" style="color:#6A6A6A">{{staffInfo.deptName}}-{{staffInfo.postName}}</div>
        </div>
        <div class="norecordList" v-if="recordList.length==0">
          <div>
            
          </div>
        </div>
        <div class="recordList" v-if="recordList.length>0">
          sdfsdfds
        </div>
      </div>
    </div>
    <div class="panel-opacity"></div>
  </div>
</template>

<script>
import api from "@/common/api.service";
export default {
  name: "Clockin",
  data() {
    return {
      organInfo: {},
      staffInfo:{},
      recordList:[]    
    };
  },
   mounted () {
     
    },
  created() {
    this.organInfo = JSON.parse(localStorage.getItem('organInfo'))
    this.staffInfo = JSON.parse(localStorage.getItem('staffInfo'))
    this.showMap();
    this.getRecordList();
  },
  computed: {},
  methods: {
    checkHeathy () {
        this.$router.push({
                path: '/healthForm',
                query: {
                    staffId:this.$route.query.staffId                    
                }
            })
    },
    getRecordList () {
       var _that = this;
      api.post("checkInRecordService/findCheckInRecordListByStaffCode", {pageNum: 1,pageSize: 10,staffCode:this.$route.query.staffId}).then(function(json){
        if(json.data.success) {
          _that.recordList = json.data.data;
        } else {
        //   _that.$message({
        //   // message: '获取机构信息失败'
        // });
        }
      })
    },
    /**
     *  打开地图
     * @param {object}info 地图信息
     * @returns {void}
     */
    showMap () {
        var  _that = this, navurl, map, point, overlay, navCon;
        setTimeout(function() {
            map = new BMap.Map('map');
            point = new BMap.Point(_that.organInfo.longitude, _that.organInfo.latitude);
            overlay = new BMap.Marker(point);
            /*
              创建一个坐标
               */
            navCon = new BMap.NavigationControl({
                anchor: BMAP_ANCHOR_TOP_RIGHT,
                type: BMAP_NAVIGATION_CONTROL_SMALL
            });
            map.addControl(navCon);
            /*
            地图初始化，设置中心点坐标和地图级别
             */
            map.addOverlay(overlay);
            /*
            设置地图可以缩放
             */
            map.centerAndZoom(point, 15);
        }, 500);
    }
    
  }
};
</script>
<style>
.healthyCheck{
  width:80px;
  height:80px;
  background-color:#4D4DFD;
  color:#fff;
  font-size:18px;
  font-weight:bold;
  position:absolute;
  line-height:80px;
  border-radius:40px;
  text-align:center;
      z-index: 99;
    top: 30%;
    left: 50%;
    margin-left: -40px;
}
.daka_staffinfo{
  font-size:14px;
  padding:5px 0px;
}
.panel{
  width: 95%;
    border-radius: 20px;
    margin-top: -30px;
    z-index: 999;
    background-color: #fff;
    position: absolute;
        box-shadow: 0px 6px 7px 7px #F2F4F6;
}
.recordList{
  border-top:1px dashed #EAEBEE;
}
</style>
